//
//  CustomerHeader.h
//  CustomerService
//
//  Created by 王俊杰 on 2018/12/19.
//  Copyright © 2018年 刘讲话. All rights reserved.
//

#ifndef CustomerHeader_h
#define CustomerHeader_h

//只有在DEBUG模式下打印
#ifndef __OPTIMIZE__
#define DLog(...) NSLog(__VA_ARGS__)
#else
#define DLog(...){}
#endif

#define CYL_DEPRECATED(explain) __attribute__((deprecated(explain)))
#define CYL_IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)

#define CYL_IS_IOS_11  ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.f)
#define CYL_IS_IPHONE_X (CYL_IS_IOS_11 && CYL_IS_IPHONE && (MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) >= 375 && MAX([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) >= 812))
// 判断是否是iPhone X
#define iPhoneX CYL_IS_IPHONE_X
// 状态栏高度
#define STATUS_BAR_HEIGHT (iPhoneX ? 44.f : 20.f)
// 导航栏高度
#define NAVIGATION_BAR_HEIGHT (iPhoneX ? 88.f : 64.f)
// tabBar高度
#define TAB_BAR_HEIGHT (iPhoneX ? (49.f+34.f) : 49.f)

#define ANIMATION_DURATION 1.5
/** 弱引用/强引用 **/
#define LRWeakSelf(type)  __weak typeof(type) weak##type = type;
#define LRStrongSelf(type)  __strong typeof(type) type = weak##type;

#define USERDEFAULTS [NSUserDefaults standardUserDefaults]

//appdelegate的实例对象
#define kAppdelegate ((AppDelegate *)[UIApplication sharedApplication].delegate)
// 获取RGB颜色
/**空值判断*/
//字符串
#define IS_EMPTY_STRING(_str)        (((_str) == nil) || ([(_str) isEqual:[NSNull null]]) ||([(_str)isEqualToString:@""]))
//空值字符串处理
#define SAFE_STRING(_str) ((((_str) == nil) || ([(_str) isEqual:[NSNull null]])) ? ((_str) = @"") : ((_str) = (_str)))
//数组
#define IS_EMPTY_ARRAY(_arr)        (((_arr) == nil) || ([(_arr) isEqual:[NSNull null]]) ||([(_arr) count] ==0))
//获取图片资源
#define IMAGE_IMAGENAME(imageName) [UIImage imageNamed:[NSString stringWithFormat:@"%@",imageName]]
#define GET_STORYBOARD(name) [UIStoryboard storyboardWithName:[NSString stringWithFormat:@"%@",name] bundle:nil]
//屏幕宽
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
//屏幕高
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
#define SCREEN_SIZE [UIScreen mainScreen].bounds.size
//自适应尺寸(以6s尺寸为基准，例如参数中的value值为10 在6s上为10 在Plus上为value/375*Plus的屏幕宽度，此外这个尺寸只以屏幕宽度为准，就算横屏状态下横竖颠倒，依然以短的尺寸为宽度)
#define AUTO_375SIZE(value) (((value)/375.0) * (([UIScreen mainScreen].bounds.size.width > [UIScreen mainScreen].bounds.size.height)?[UIScreen mainScreen].bounds.size.height:[UIScreen mainScreen].bounds.size.width))
/** 颜色字体*/
#define COLOR_RGB_ALPHA(r,g,b,a)      ([UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)])
//简体
#define FONT_SYSTEM(x) ([UIFont systemFontOfSize:(x)])
//粗体
#define FONT_BOLDSYSTEM(x) [UIFont boldSystemFontOfSize:x]
//获取当前版本号
#define APP_VERSION [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]

//分页数量
#define PAGESIZE @"10"

#endif /* CustomerHeader_h */
